Copyright: VB-Helper DLL Help
Citation: VB-Helper DLL Help


Help Contents
VB-Helper DLL (32-bit), Copyright © 1996-97 SoftCircuits

Redistributed by Permission

Memory

vbGetAddress

vbFillMemory

vbCopyMemory

Byte/Word Conversion

vbHiByte

vbHiWord

vbLoByte

vbLoWord

vbMakeLong

vbMakeWord

Shifting Bits

vbRotateLeft

vbRotateLeftLong

vbRotateRight

vbRotateRightLong

vbShiftLeft

vbShiftLeftLong

vbShiftRight

vbShiftRightLong

Packing User-Defined Types

vbPackUDT

vbPackUDTFree

vbPackUDTGetSize

vbUnpackUDT

Miscellaneous

vbGetHelperVersion

vbShowAboutBox

Program Information

Revision History

About SoftCircuits


vbGetAddress

Declaration:

Declare Function vbGetAddress Lib "VBHLP32.DLL" (pData As Any) As Long

Description:

Returns the address of pData.

Note that Visual Basic passes a copy of some variables (for example, variable-length strings and user-defined types that contain strings) when calling DLL functions. In these cases the value returned by vbGetAddress is not normally helpful since it will be the address of the copy which is temporary.

See Also:

vbCopyMemory, vbFillMemory


vbFillMemory

Declaration:

Declare Sub vbFillMemory Lib "VBHLP32.DLL" (pDest As Any, ByVal nValue As Byte, ByVal nCount As Long)

Description:

Fills an area of memory with the specified value. pDest is the address of the memory to be modified, nValue is the value that each byte will be set to, and nCount is the number of bytes to fill.

See Also:

vbCopyMemory, vbGetAddress


vbCopyMemory

Declaration:

Declare Sub vbCopyMemory Lib "VBHLP32.DLL" (pDest As Any, pSource As Any, ByVal nCount As Long)

Description:

Copies an area of memory to another location. If portions of the source and destination memory overlap, steps are taken to ensure data is copied correctly. pDest is the address of the memory to be copied to, pSource is the address of the memory to be copied from, and nCount is the number of bytes to copy.

See Also:

vbFillMemory, vbGetAddress


vbLoByte

Declaration:

Declare Function vbLoByte Lib "VBHLP32.DLL" (ByVal nValue As Integer) As Integer

Description:

Returns the low-order byte of nValue.

See Also:

vbHiByte, vbHiWord, vbLoWord


vbHiByte

Declaration:

Declare Function vbHiByte Lib "VBHLP32.DLL" (ByVal nValue As Integer) As Integer

Description:

Returns the high-order byte of nValue.

See Also:

vbHiWord, vbLoByte, vbLoWord


vbLoWord

Declaration:

Declare Function vbLoWord Lib "VBHLP32.DLL" (ByVal nValue As Long) As Integer

Description:

Returns the low-order word of nValue.

See Also:

vbHiByte, vbHiWord, vbLoByte


vbHiWord

Declaration:

Declare Function vbHiWord Lib "VBHLP32.DLL" (ByVal nValue As Long) As Integer

Description:

Returns the high-order word of nValue.

See Also:

vbHiByte, vbLoByte, vbLoWord


vbMakeWord

Declaration:

Declare Function vbMakeWord Lib "VBHLP32.DLL" (ByVal nLoByte As Integer, ByVal nHiByte As Integer) As Integer

Description:

Combines two byte values into a word value.

See Also:

vbMakeLong


vbMakeLong

Declaration:

Declare Function vbMakeLong Lib "VBHLP32.DLL" (ByVal nLoWord As Integer, ByVal nHiWord As Integer) As Long

Description:

Combines two word values into a long value.

See Also:

vbMakeWord


vbShiftRight

Declaration:

Declare Function vbShiftRight Lib "VBHLP32.DLL" (ByVal nValue As Integer, ByVal nBits As Integer) As Integer

Description:

Shifts the bits in nValue right the number of times specified by nBits. The left-most bits opened up by the shift are set to 0.

See Also:

vbRotateLeft, vbRotateLeftLong, vbRotateRight, vbRotateRightLong, vbShiftLeft, vbShiftLeftLong, vbShiftRightLong


vbShiftLeft

Declaration:

Declare Function vbShiftLeft Lib "VBHLP32.DLL" (ByVal nValue As Integer, ByVal nBits As Integer) As Integer

Description:

Shifts the bits in nValue left the number of times specified by nBits. The right-most bits opened up by the shift are set to 0.

See Also:

vbRotateLeft, vbRotateLeftLong, vbRotateRight, vbRotateRightLong, vbShiftLeftLong, vbShiftRight, vbShiftRightLong


vbShiftRightLong

Declaration:

Declare Function vbShiftRightLong Lib "VBHLP32.DLL" (ByVal nValue As Long, ByVal nBits As Integer) As Long

Description:

Shifts the bits in nValue right the number of times specified by nBits. The left-most bits opened up by the shift are set to 0.

See Also:

vbRotateLeft, vbRotateLeftLong, vbRotateRight, vbRotateRightLong, vbShiftLeft, vbShiftLeftLong, vbShiftRight


vbShiftLeftLong

Declaration:

Declare Function vbShiftLeftLong Lib "VBHLP32.DLL" (ByVal nValue As Long, ByVal nBits As Integer) As Long

Description:

Shifts the bits in nValue left the number of times specified by nBits. The right-most bits opened up by the shift are set to 0.

See Also:

vbRotateLeft, vbRotateLeftLong, vbRotateRight, vbRotateRightLong, vbShiftLeft, vbShiftRight, vbShiftRightLong


vbRotateRight

Declaration:

Declare Function vbRotateRight Lib "VBHLP32.DLL" (ByVal nValue As Integer, ByVal nBits As Integer) As Integer

Description:

Rotates the bits in nValue right the number of times specified by nBits. For each rotation, the right-most bit is copied to the left-most bit.

See Also:

vbRotateLeft, vbRotateLeftLong, vbRotateRightLong, vbShiftLeft, vbShiftLeftLong, vbShiftRight, vbShiftRightLong


vbRotateLeft

Declaration:

Declare Function vbRotateLeft Lib "VBHLP32.DLL" (ByVal nValue As Integer, ByVal nBits As Integer) As Integer

Description:

Rotates the bits in nValue left the number of times specified by nBits. For each rotation, the left-most bit is copied to the right-most bit.

See Also:

vbRotateLeftLong, vbRotateRight, vbRotateRightLong, vbShiftLeft, vbShiftLeftLong, vbShiftRight, vbShiftRightLong


vbRotateRightLong

Declaration:

Declare Function vbRotateRightLong Lib "VBHLP32.DLL" (ByVal nValue As Long, ByVal nBits As Integer) As Long

Description:

Rotates the bits in nValue right the number of times specified by nBits. For each rotation, the right-most bit is copied to the left-most bit.

See Also:

vbRotateLeft, vbRotateLeftLong, vbRotateRight, vbShiftLeft, vbShiftLeftLong, vbShiftRight, vbShiftRightLong


vbRotateLeftLong

Declaration:

Declare Function vbRotateLeftLong Lib "VBHLP32.DLL" (ByVal nValue As Long, ByVal nBits As Integer) As Long

Description:

Rotates the bits in nValue left the number of times specified by nBits. For each rotation, the left-most bit is copied to the right-most bit.

See Also:

vbRotateLeft, vbRotateRight, vbRotateRightLong, vbShiftLeft, vbShiftLeftLong, vbShiftRight, vbShiftRightLong


vbPackUDT

Declaration:

Declare Sub vbPackUDT Lib "VBHLP32.DLL" (pUDT As Any, ppResult As Long, ByVal pszFields As String)

Description:

Creates of copy of a user-defined type (UDT) and removes any padding that VB may have added as a result of DWORD alignment.

32-bit versions of Visual Basic will insert bytes into UDT variables as padding to keep 32-bit members aligned on a 32-bit address. This padding can result in more efficient member access on 32-bit processors. However, Visual Basic provides no workaround for those rare instances where you need to interface with API or DLL functions that take UDTs with no padding. In these cases, you can use vbPackUDT to create a copy of a UDT and remove any padding that VB may have added.

pUDT is the UDT variable to be packed. vbPackUDT makes a copy of this UDT and places the address of the copy in ppResult. pszFields is a string that contains one character for each member of the UDT. Each character indicates the type of each member and must be one of the following characters:

"s"	Variable-length string

"b"	Byte or String * 1

"i"	Integer or Boolean

"l"	Long

"f"	Single (float)

"d"	Double

For UDTs that contain arrays, you must repeat the member type for each item in the array. For fixed-length strings, use "b" for each character in the string.

On return, ppResult contains the address of the packed data or 0 if one of the field codes was invalid or there was not enough system memory.

Some precautions must be taken when using vbPackUDT. Each time this routine is called, a block of memory is allocated from the system. When the DLL unloads, this memory will automatically be freed. However, if your program might call vbPackUDT more than once before terminating, you should call vbPackUDTFree each time to explicitly release allocated memory. Note, however, that if you need to unpack the UDT after the call, you must not free the memory before calling vbUnpackUDT.

In addition, UDTs with variable-length strings require additional precautions. For these UDTs, vbPackUDT will allocate a separate block of memory to hold the actual string data. Therefore, you should avoid copying the packed data of UDTs with variable-length strings as the string members will refer to memory that is located elsewhere and may be temporary. Also, when calling vbUnpackUDT to unpack a UDT that contains variable-length strings, make sure the string members in the UDT passed to vbUnpackUDT are big enough to hold the string returned.

See Also:

vbPackUDTFree, vbPackUDTGetSize, vbUnpackUDT


vbUnpackUDT

Declaration:

Declare Sub vbUnpackUDT Lib "VBHLP32.DLL" (pUDT As Any, ppResult As Long)

Description:

Unpacks a user-defined type (UDT) packed by vbPackUDT. pUDT is the UDT to receive the data. This UDT must be of the same type that was passed to vbPackUDT when the data was packed. ppResult must be a value obtained from the call to vbPackUDT.

For UDTs that contain variable-length strings, you must ensure that string members are big enough to hold the string being returned. Normally, this simply means that you should not reduce the size of variable-length string members between the call to vbPackUDT and vbUnpackUDT.

See Also:

vbPackUDT, vbPackUDTFree, vbPackUDTGetSize


vbPackUDTGetSize

Declaration:

Declare Function vbPackUDTGetSize Lib "VBHLP32.DLL" (ppResult As Long) As Long

Description:

Returns the size of a user-defined type (UDT) packed by vbPackUDT. ppResult must be a value obtained from the call to vbPackUDT. If ppResult is not a valid packed UDT value, this function returns 0.

Note: You should not make any assumptions about the actual size of the memory block allocated by vbPackUDT which will be bigger than the value returned by vbPackUDTGetSize.

See Also:

vbPackUDT, vbPackUDTFree, vbUnpackUDT


vbPackUDTFree

Declaration:

Declare Sub vbPackUDTFree Lib "VBHLP32.DLL" (ppResult As Long)

Description:

Frees the memory allocated for a user-defined type (UDT) packed by vbPackUDT. ppResult must be a value obtained from the call to vbPackUDT. If this function is successful, ppResult is set to 0.

Each time you call vbPackUDT, a block of memory is allocated from the system. When the DLL unloads, this memory will automatically be freed. However, if your program might call vbPackUDT more than once before terminating, you should call vbPackUDTFree each time to explicitly release allocated memory. Note, however, that if you need to unpack the UDT after the call, you must not free the memory before calling vbUnpackUDT.

See Also:

vbPackUDT, vbPackUDTGetSize, vbUnpackUDT


vbShowAboutBox

Declaration:

Declare Sub vbShowAboutBox Lib "VBHLP32.DLL" ()

Description:

Opens a dialog box that displays version and copyright information for VBHLP32.DLL.

See Also:

vbGetHelperVersion


vbGetHelperVersion

Declaration:

Declare Function vbGetHelperVersion Lib "VBHLP32.DLL" () As Integer

Description:

Returns the VB-Helper DLL version. The high byte contains the major version, and the low byte contains the minor version. For example, a return value of &H20A would indicate version 2.10.

See Also:

vbShowAboutBox


SoftCircuits
About SoftCircuits

SoftCircuits Programming

P.O. Box 16262

Irvine, CA 92623

For the latest information about SoftCircuits, visit us on the World Wide Web at http://www.softcircuits.com.

SoftCircuits is a trademark and SoftCircuits Programming is a registered trademark of SoftCircuits.


Revision History

This section is set aside for tracking program revisions.

Version	Comments

2.02	-	Took advantage of improved compiler technology for tighter, faster code.

-	Updated sample programs to Visual Basic 5.

2.01	-	The vbPackUDT and vbUnpackUDT routines contained a bug in the code that determined the offset of unpacked UDT elements. This bug could cause problems with UDTs that contain elements greater than 4 bytes in size. This bug has been corrected.

2.00	-	Original 32-bit Version. Note: A similar 16-bit DLL with the same name received very little distribution. If your application is 32-bit running under a 32-bit operating system and you call into this DLL, you can safely assume that it is version 2.00 or higher.